// JavaScript Document


function validate()
{
	
	if(document.questionnaire3.district[document.questionnaire3.district.selectedIndex].value==0)
	{
	  alert("Please Select District Name");
	  document.questionnaire3.district.focus();
	   return false;
	}
	if(document.questionnaire3.block[document.questionnaire3.block.selectedIndex].value==0)
	{
	  alert("Please Select Block Name");
	  document.questionnaire3.block.focus();
	   return false;
	}
	if(document.questionnaire3.tehsil[document.questionnaire3.tehsil.selectedIndex].value==0)
	{
	  alert("Please Select Tehsil Name");
	  document.questionnaire3.tehsil.focus();
	   return false;
	}
	if(document.questionnaire3.panchayat[document.questionnaire3.panchayat.selectedIndex].value==0)
	{
	  alert("Please Select Panchayat Name");
	  document.questionnaire3.panchayat.focus();
	   return false;
	}
	if(document.questionnaire3.village[document.questionnaire3.village.selectedIndex].value==0)
	{
	  alert("Please Select Village Name");
	  document.questionnaire3.village.focus();
	   return false;
	}
	if(document.questionnaire3.steam.value=="")
	{
	   alert('Please Select Survey Team name');
	   document.questionnaire3.steam.focus();
	   return false;
	 }
	
   if(!document.questionnaire3.cpo.checked && !document.questionnaire3.psd.checked && !document.questionnaire3.sds.checked &&    !document.questionnaire3.gs.checked && !document.questionnaire3.patwari.checked && !document.questionnaire3.hms.checked &&    !document.questionnaire3.phed.checked)
    {
    alert('Please Check at Least One Key Person');
	//document.questionnaire3.cpo.focus();
	//document.getElementById('cpo').focus();
	//document.questionnaire3.cpo.checked=true;
	//document.questionnaire3.person_name1.disabled=false;
	//document.questionnaire3.person_name1.focus();
	return false;
    }
	else
	{
	if(document.questionnaire3.cpo.checked && document.questionnaire3.person_name1.value=="")
	{
	alert('Please Enter PHED Officer');
	document.questionnaire3.person_name1.focus();
	return false;
	}
	if(document.questionnaire3.psd.checked && document.questionnaire3.person_name2.value=="")
	{
	alert('Please Enter PHED Sub- Division');
	document.questionnaire3.person_name2.focus();
	return false;
	}
	if(document.questionnaire3.sds.checked && document.questionnaire3.person_name3.value=="")
	{
	alert('Please Enter Sarpanch/Dy. Sarpanch');
	document.questionnaire3.person_name3.focus();
	return false;
	}
	if(document.questionnaire3.gs.checked && document.questionnaire3.person_name4.value=="")
	{
	alert('Please Enter Gram Sewak');
	document.questionnaire3.person_name4.focus();
	return false;
	}
	if(document.questionnaire3.patwari.checked && document.questionnaire3.person_name5.value=="")
	{
	alert('Please Enter Patwari');
	document.questionnaire3.person_name5.focus();
	return false;
	}
	if(document.questionnaire3.hms.checked && document.questionnaire3.person_name6.value=="")
	{
	alert('Please Enter Head Master, Govt. School');
	document.questionnaire3.person_name6.focus();
	return false;
	}
	if(document.questionnaire3.phed.checked && document.questionnaire3.person_name7.value=="")
	{
	alert('Please Enter PHED Operator/Staff');
	document.questionnaire3.person_name7.focus();
	return false;
	}
	}
	var counthabit=document.getElementById('habcount').value;
	for(var i=1;i<=counthabit;i++)
	{
	if(document.getElementById('status'+i).checked && document.getElementById('household'+i).value=="")
	{
		var r=confirm('Approx Num. of Households Field is Mandatory, if You have Data for this Field Click OK and if You Click on Cancel form will be Canceled');
		if(r==true)
		{
			document.getElementById('household'+i).focus();
			return false;
		}
       alert('Fill Up Form is Canceled');
       location.reload(true);
       document.questionnaire3.district.focus();
      return false;
   }
	if(!document.getElementById('status'+i).checked)
	{
	var r=confirm('If All Habitations are Non Tracable then Form will be Canceled!If any Habitation is Existing Press OK otherwise Click Canceled');
    if(r==true)
	{
	document.getElementById('status'+i).focus();
			return false;
	
	}
	alert('Fill Up Form is Canceled');
	location.reload(true);
	return false;
	}
	}
	
	

	return true; 
}


function alphabet(field)
{
var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only Alphabetic Characters are Accepted!");
//field.focus();
field.select();
return false;
   }

}


function numeric(field)
{
var valid = "0123456789 "
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only Numeric Characters are Accepted!");
//field.focus();
field.select();
return false;
   }

}


function add(obj)
{

a1=document.getElementById('population_sc'+obj).value;
a1=Number(a1);
a2=document.getElementById('population_st'+obj).value;
a2=Number(a2);
a3=document.getElementById('population_other'+obj).value;
a3=Number(a3);
a4=(a1+a2+a3);
document.getElementById('population_total'+obj).value=a4;
//document.getElementById('population_total'+obj).disabled=false;
}



/*function empty2(obj)
{
//var f1=document.getElementById('water_received_household'+obj).value;
//var f2=document.getElementById('monthly_spent_household'+obj).value;
var f3=document.getElementById('house_connection_qty'+obj);
var f4=document.getElementById('handpump_qty'+obj);
var f5=document.getElementById('handpump_avg_dist'+obj);
var f6=document.getElementById('common_tap_qty'+obj);
var f7=document.getElementById('common_tap_avg_dist'+obj);
var f8=document.getElementById('tradi_source_qty'+obj);
var f9=document.getElementById('tradi_source_avg_dist'+obj);
var f10=document.getElementById('tankers_qty'+obj);
var f11=document.getElementById('tankers_avg_dist'+obj);
var f12=document.getElementById('water_not_available'+obj);
var f13=document.getElementById('num_hrs_pre_monsoon'+obj);
var f14=document.getElementById('num_hrs_post_monsoon'+obj);
if(document.getElementById('water_received_household'+obj).value=="" || document.getElementById('monthly_spent_household'+obj).value=="" || f3.value=="" || f4.value=="" || f5.value=="" || f6.value=="" || f7.value=="" || f8.value=="" || f9.value=="" || f10.value=="" || f11.value=="" || f12.value=="" || f13.value=="" || f14.value=="")
{
alert('empty');
}
}*/






function enable_text(status)
{
  status=!status;
  document.questionnaire3.person_name1.disabled=status;
  document.questionnaire3.person_name2.disabled=status;
  document.questionnaire3.person_name3.disabled=status;
  document.questionnaire3.person_name4.disabled=status;
  document.questionnaire3.person_name5.disabled=status;
  document.questionnaire3.person_name6.disabled=status;
  document.questionnaire3.person_name7.disabled=status;
  
}
function enable_text1(status)
{
  status=!status;
  document.questionnaire3.person_name1.disabled=status;
}
function enable_text2(status)
{
  status=!status;
  document.questionnaire3.person_name2.disabled=status;
}
function enable_text3(status)
{
  status=!status;
  document.questionnaire3.person_name3.disabled=status;
}
function enable_text4(status)
{
  status=!status;
  document.questionnaire3.person_name4.disabled=status;
}
function enable_text5(status)
{
  status=!status;
  document.questionnaire3.person_name5.disabled=status;
}
function enable_text6(status)
{
  status=!status;
  document.questionnaire3.person_name6.disabled=status;
}

function enable_text7(status)
{
  status=!status;
  document.questionnaire3.person_name7.disabled=status;
}


function setReadOnly(valobj,obj)
{
	//alert(valobj);
   if(valobj=="Existing")
   {
	
   //document.getElementById('population_sc1').style.backgroundcolor="#ffffff";
   //document.getElementById('population_sc1').readonly=0;
   //document.getElementById('population_sc1').value="";
   document.getElementById('household'+obj).disabled=false;
   document.getElementById('population_sc'+obj).disabled=false;
   document.getElementById('population_st'+obj).disabled=false;
   document.getElementById('population_other'+obj).disabled=false;
   document.getElementById('population_total'+obj).disabled=false;
   
   }
   else
  {
   
   document.getElementById('household'+obj).style.backgroundcolor="#eeeeee";
   //document.getElementById('population_sc1').readonly=1;
   //document.getElementById('population_sc1').value="Not Applicable";
   document.getElementById('household'+obj).disabled=true;
   document.getElementById('population_sc'+obj).disabled=true;
   document.getElementById('population_st'+obj).disabled=true;
   document.getElementById('population_other'+obj).disabled=true;
   document.getElementById('population_total'+obj).disabled=true;
  }
  
  
}


function validate2()
{
   var counthouse=document.getElementById('housecount').value;
   for(var j=1;j<=counthouse;j++){
   if(document.getElementById('house_connection_qty'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('house_connection_qty'+j).focus();
	 return false;
	 }
	if(document.getElementById('handpump_qty'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('handpump_qty'+j).focus();
	 return false;
	 }
	 if(document.getElementById('handpump_avg_dist'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('handpump_avg_dist'+j).focus();
	 return false;
	 }
	 if(document.getElementById('common_tap_qty'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('common_tap_qty'+j).focus();
	 return false;
	 }
	 if(document.getElementById('common_tap_avg_dist'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('common_tap_avg_dist'+j).focus();
	 return false;
	 }
	 if(document.getElementById('tradi_source_qty'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('tradi_source_qty'+j).focus();
	 return false;
	 }
	 if(document.getElementById('tradi_source_avg_dist'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('tradi_source_avg_dist'+j).focus();
	 return false;
	 }
	 if(document.getElementById('tankers_qty'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('tankers_qty'+j).focus();
	 return false;
	 }
	 if(document.getElementById('tankers_avg_dist'+j).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NI');
	 document.getElementById('tankers_avg_dist'+j).focus();
	 return false;
	 }
	 if(document.getElementById('water_not_available'+j).value=="")
    {
     alert('Please Fill the "Water Not Available" Field, If you have no data for this form will be canceled');
	 var r=confirm('Do You Want to Really Reject the Form Press OK Otherwise Cancel');
	 if(r==true)
	 {
	 window.location="../ramky/questionnaire3.php"
	 return false;
	 }
	 else
	 {
	 document.getElementById('water_not_available'+j).focus();
	 return false;
	 }
	 }
	 if(document.getElementById('num_hrs_pre_monsoon'+j).value=="")
    {
     alert('Please Fill the "No. of Hrs./Day Pre Monsoon Available" Field, If you have no data for this form will be canceled');
	 var r=confirm('Do You Want to Really Reject the Form Press OK Otherwise Cancel');
	 if(r==true)
	 {
	 window.location="../ramky/questionnaire3.php"
	 return false;
	 }
	 else
	 {
	 document.getElementById('num_hrs_pre_monsoon'+j).focus();
	 return false;
	 }
	 }
	 if(document.getElementById('num_hrs_post_monsoon'+j).value=="")
    {
     alert('Please Fill the "No. of Hrs./Day Post Monsoon" Field, If you have no data for this form will be canceled');
	 var r=confirm('Do You Want to Really Reject the Form Press OK Otherwise Cancel');
	 if(r==true)
	 {
	 window.location="../ramky/questionnaire3.php"
	 return false;
	 }
	 else
	 {
	 document.getElementById('num_hrs_post_monsoon'+j).focus();
	 return false;
	 }
	 }
	 
}
}


function validate3()
{
   var pumpcount=document.getElementById('handpumpcount').value;
   //var boilcount=document.getElementById('boil').value;
   //alert(boilcount);
   for(var k=1;k<=pumpcount;k++)
   {
	   
   if(document.getElementById('handpump_govt'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('handpump_govt'+k).focus();
	 return false;
	 }
   if(document.getElementById('handpump_pvt'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('handpump_pvt'+k).focus();
	 return false;
	 }
	if(document.getElementById('pipedwater'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('pipedwater'+k).focus();
	 return false;
	 }
    if(document.getElementById('tubewell'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('tubewell'+k).focus();
	 return false;
	 }
	if(document.getElementById('dugwell'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('dugwell'+k).focus();
	 return false;
	 }
	if(document.getElementById('public_taps'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('public_taps'+k).focus();
	 return false;
	 }
	if(document.getElementById('rain_water_tank'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('rain_water_tank'+k).focus();
	 return false;
	 }
	if(document.getElementById('tanker_truck'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('tanker_truck'+k).focus();
	 return false;
	 }
	if(document.getElementById('small_tank'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('small_tank'+k).focus();
	 return false;
	 }
	if(document.getElementById('surface_water'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('surface_water'+k).focus();
	 return false;
	 }
	if(document.getElementById('irrigation_canal'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('irrigation_canal'+k).focus();
	 return false;
	 }
	if(document.getElementById('other_source'+k).value=="")
    {
     alert('Plese Enter Valid Data Otherwise Write NA');
	 document.getElementById('other_source'+k).focus();
	 return false;
	 }
	 //for(var m=1;m<8;m++){
	 //var check= new Array(8);
	 /*check=document.getElementById('treat_water_safe'+k+'[]').value;
	 //alert(check.length);
	 //alert(check[0]);//}
	 //for(var m=1;m<check.length;m++){
	 alert(check);
	 if(document.getElementById('treat_water').value=='YES' && !check.checked)
	{
		
		alert('Please Check at Least One Check Box');
		return false;
	}*/
	 //}
	 var rad=document.getElementById('treat_water');
	 //alert(rad.value);
	 var chks = document.getElementsByName('treat_water_safe'+k+'[]');
     var hasChecked = false;
     if(rad.checked)
	 {
	 for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert("Please select at least one option for keeping water safe.");
    return false;
    }
	}
	
    

}
    return true;
}



function numeric1(field)
{
    var valid = "0123456789 "
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
    //field.focus();
    field.select();
    return false;
    }
	if(field.value<1 || field.value>12)
    {
		alert('Please Enter 1-12 No.');
		//document.getElementById('months_water_retained_bawaries').select();
		//field.select();
		return false;
	}
}


function numeric2(field)
{
    
	var valid = "0123456789 "
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
    //field.focus();
    field.select();
    return false;
    }
	if(field.value<1 || field.value>10)
    {
		alert('Please Enter 1-10 No.');
		field.select();
		return false;
	}
}

function validate6()
{
	if(document.getElementById('numbers_bawaries').value=="")
   {
      alert('Please Enter Numbers of Bawaries Field');
	  document.getElementById('numbers_bawaries').focus();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_bawaries').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_bawaries').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_bawaries').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_bawaries').value!=a4)
   {
   alert('Please Check! Total number of Bawaries and num. of Operational Status of Bawaries should be Equal');
   document.getElementById('numbers_bawaries').select();
   return false;
   }
   if(document.getElementById('numbers_old_open_well').value=="")
   {
      alert('Please Enter Numbers of Old Open Well Field');
	  document.getElementById('numbers_old_open_well').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_old_open_well').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_old_open_well').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_old_open_well').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_old_open_well').value!=a4)
   {
   alert('Please Check! Total number of Old Open Well and num. of Operational Status of Old Open Well should be Equal');
   document.getElementById('numbers_old_open_well').select();
   return false;
   }
	if(document.getElementById('numbers_tankas_public').value=="")
   {
      alert('Please Enter Numbers of Tankas Public Field');
	  document.getElementById('numbers_tankas_public').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_tankas_public').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_tankas_public').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_tankas_public').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_tankas_public').value!=a4)
   {
   alert('Please Check! Total number of Tankas Public and num. of Operational Status of Tankas Public should be Equal');
   document.getElementById('numbers_tankas_public').select();
   return false;
   }
	if(document.getElementById('numbers_tankas_household').value=="")
   {
      alert('Please Enter Numbers of Tankas Household Field');
	  document.getElementById('numbers_tankas_household').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_tankas_household').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_tankas_household').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_tankas_household').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_tankas_household').value!=a4)
   {
   alert('Please Check! Total number of Tankas Household and num. of Operational Status of Tankas Household should be Equal');
   document.getElementById('numbers_tankas_household').select();
   return false;
   }
	if(document.getElementById('numbers_ponds_pucca').value=="")
   {
      alert('Please Enter Numbers of Ponds Pucca Field');
	  document.getElementById('numbers_ponds_pucca').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_ponds_pucca').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_ponds_pucca').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_ponds_pucca').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_ponds_pucca').value!=a4)
   {
   alert('Please Check! Total number of Ponds Pucca and num. of Operational Status of Ponds Pucca should be Equal');
   document.getElementById('numbers_ponds_pucca').select();
   return false;
   }
	if(document.getElementById('numbers_ponds_kachha').value=="")
   {
      alert('Please Enter Numbers of Ponds Kachha Field');
	  document.getElementById('numbers_ponds_kachha').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_ponds_kachha').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_ponds_kachha').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_ponds_kachha').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_ponds_kachha').value!=a4)
   {
   alert('Please Check! Total number of Ponds Kachha and num. of Operational Status of Ponds Kachha should be Equal');
   document.getElementById('numbers_ponds_kachha').select();
   return false;
   }
	if(document.getElementById('numbers_canal_water_ponds').value=="")
   {
      alert('Please Enter Numbers of Canal Water Ponds Field');
	  document.getElementById('numbers_canal_water_ponds').select();
	  return false;
   }
   a1=document.getElementById('operational_status_functional_canal_water').value;
   a1=Number(a1);
   a2=document.getElementById('operational_status_made_functional_canal_water_ponds').value;
   a2=Number(a2);
   a3=document.getElementById('operational_status_not_repairable_canal_water_ponds').value;
   a3=Number(a3);
   a4=(a1+a2+a3);
   if(document.getElementById('numbers_canal_water_ponds').value!=a4)
   {
   alert('Please Check! Total number of Canal Water Ponds and num. of Operational Status of Canal Water Ponds should be Equal');
   document.getElementById('numbers_canal_water_ponds').select();
   return false;
   }
		
	if(document.getElementById('filling_rain_water_ponds_bawaries').value=="")
   {
      alert('Please Enter Method of Ponds Bawaries Field');
	  document.getElementById('filling_rain_water_ponds_bawaries').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_old_open_well').value=="")
   {
      alert('Please Enter Method of Ponds Old Open Well Field');
	  document.getElementById('filling_rain_water_ponds_old_open_well').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_tankas_public').value=="")
   {
      alert('Please Enter Method of Ponds Tankas Public Field');
	  document.getElementById('filling_rain_water_ponds_tankas_public').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_tankas_household').value=="")
   {
      alert('Please Enter Method of Ponds Tankas Household Field');
	  document.getElementById('filling_rain_water_ponds_tankas_household').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_ponds_pucca').value=="")
   {
      alert('Please Enter Method of Ponds in Ponds Pacca Field');
	  document.getElementById('filling_rain_water_ponds_ponds_pucca').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_ponds_kachha').value=="")
   {
      alert('Please Enter Method of Ponds in Ponds Kachha Field');
	  document.getElementById('filling_rain_water_ponds_ponds_kachha').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_ponds_canal_water_ponds').value=="")
   {
      alert('Please Enter Method of Ponds in Canal Water Ponds Field');
	  document.getElementById('filling_rain_water_ponds_canal_water_ponds').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_bawaries').value=="")
   {
      alert('Please Enter Method of Tankas in Bawaries Field');
	  document.getElementById('filling_rain_water_tankas_bawaries').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_old_open_well').value=="")
   {
      alert('Please Enter Method of Tankas in Old Open Well Field');
	  document.getElementById('filling_rain_water_tankas_old_open_well').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_tankas_public').value=="")
   {
      alert('Please Enter Method of Tankas in Tankas Public Field');
	  document.getElementById('filling_rain_water_tankas_tankas_public').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_tankas_household').value=="")
   {
      alert('Please Enter Method of Tankas in Tankas Household Field');
	  document.getElementById('filling_rain_water_tankas_tankas_household').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_ponds_pucca').value=="")
   {
      alert('Please Enter Method of Tankas in Ponds Pacca Field');
	  document.getElementById('filling_rain_water_tankas_ponds_pucca').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_ponds_kachha').value=="")
   {
      alert('Please Enter Method of Tankas in Ponds Kachha Field');
	  document.getElementById('filling_rain_water_tankas_ponds_kachha').select();
	  return false;
   }
   if(document.getElementById('filling_rain_water_tankas_canal_water_ponds').value=="")
   {
      alert('Please Enter Method of Tankas in Canal Water Ponds Field');
	  document.getElementById('filling_rain_water_tankas_canal_water_ponds').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_bawaries').value=="")
   {
      alert('Please Enter Month Water Retained in Bawaries Field');
	  document.getElementById('months_water_retained_bawaries').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_old_open_well').value=="")
   {
      alert('Please Enter Month Water Retained in Old Open Well Field');
	  document.getElementById('months_water_retained_old_open_well').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_tankas_public').value=="")
   {
      alert('Please Enter Month Water Retained in Tankas Public Field');
	  document.getElementById('months_water_retained_tankas_public').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_tankas_household').value=="")
   {
      alert('Please Enter Month Water Retained in Tankas Household Field');
	  document.getElementById('months_water_retained_tankas_household').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_ponds_pacca').value=="")
   {
      alert('Please Enter Month Water Retained in Ponds Pacca Field');
	  document.getElementById('months_water_retained_ponds_pacca').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_ponds_kachha').value=="")
   {
      alert('Please Enter Month Water Retained in Ponds Kachha Field');
	  document.getElementById('months_water_retained_ponds_kachha').select();
	  return false;
   }
   if(document.getElementById('months_water_retained_canal_water_ponds').value=="")
   {
      alert('Please Enter Month Water Retained in Canal Water Ponds Field');
	  document.getElementById('months_water_retained_canal_water_ponds').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_bawaries').value=="")
   {
      alert('Please Enter Approximate Capacity in Bawaries Field');
	  document.getElementById('approximate_capacity_bawaries').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_old_open_well').value=="")
   {
      alert('Please Enter Approximate Capacity in Old Open Well Field');
	  document.getElementById('approximate_capacity_old_open_well').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_tankas_public').value=="")
   {
      alert('Please Enter Approximate Capacity in Tankas Public Field');
	  document.getElementById('approximate_capacity_tankas_public').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_tankas_household').value=="")
   {
      alert('Please Enter Approximate Capacity in Tankas Household Field');
	  document.getElementById('approximate_capacity_tankas_household').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_ponds_pucca').value=="")
   {
      alert('Please Enter Approximate Capacity in Ponds Pacca Field');
	  document.getElementById('approximate_capacity_ponds_pucca').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_ponds_kachha').value=="")
   {
      alert('Please Enter Approximate Capacity in Ponds Kachha Field');
	  document.getElementById('approximate_capacity_ponds_kachha').select();
	  return false;
   }
   if(document.getElementById('approximate_capacity_canal_water_ponds').value=="")
   {
      alert('Please Enter Approximate Capacity in Canal Water Ponds Field');
	  document.getElementById('approximate_capacity_canal_water_ponds').select();
	  return false;
   }
   if(document.getElementById('priority1').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority1').select();
	  return false;
   }
   if(document.getElementById('priority2').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority2').select();
	  return false;
   }
   if(document.getElementById('priority3').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority3').select();
	  return false;
   }
   if(document.getElementById('priority4').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority4').select();
	  return false;
   }
   if(document.getElementById('priority5').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority5').select();
	  return false;
   }
   if(document.getElementById('priority6').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority6').select();
	  return false;
   }
   if(document.getElementById('priority7').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority7').select();
	  return false;
   }
   if(document.getElementById('priority8').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority8').select();
	  return false;
   }
   if(document.getElementById('priority9').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority9').select();
	  return false;
   }
   if(document.getElementById('priority10').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority10').select();
	  return false;
   }
   if(document.getElementById('priority11').value=="")
   {
      alert('Please Enter Rank of Priority in Main Village Field');
	  document.getElementById('priority11').select();
	  return false;
   }
   return true;

}

function validate5()
{
    
	if(document.getElementById('num_glrs').value=="")
	{
	   alert('Please Enter GLRS Field');
	   document.getElementById('num_glrs').select();
	   return false;
	}
	if(document.getElementById('num_glsr').value=="")
	{
	   alert('Please Enter GLSR Field');
	   document.getElementById('num_glsr').select();
	   return false;
	}
	var glrscount=document.getElementById('countglrs').value;
	var countglsr=document.getElementById('glsrcount').value;
	for(var m=1;m<=glrscount;m++)
	{
	if(document.getElementById('glrs_numbers_phed'+m).value=="")
	{
	   alert('Please Enter GLRS Numbers PHED Field');
	   document.getElementById('glrs_numbers_phed'+m).select();
	   return false;
	}	
	if(document.getElementById('glrs_numbers_gp'+m).value=="")
	{
	   alert('Please Enter GLRS Numbers of Gram Panchayat Field');
	   document.getElementById('glrs_numbers_gp'+m).select();
	   return false;
	}
	if(document.getElementById('glrs_numbers_private'+m).value=="")
	{
	   alert('Please Enter GLRS Numbers of Private Field');
	   document.getElementById('glrs_numbers_private'+m).select();
	   return false;
	}
	if(document.getElementById('glrs_capacity_phed'+m).value=="")
	{
	   alert('Please Enter GLRS Capacity of PHED Field');
	   document.getElementById('glrs_capacity_phed'+m).select();
	   return false;
	}
	if(document.getElementById('glrs_capacity_gp'+m).value=="")
	{
	   alert('Please Enter GLRS Capacity of Gram Panchayat Field');
	   document.getElementById('glrs_capacity_gp'+m).select();
	   return false;
	}
	if(document.getElementById('glrs_capacity_private'+m).value=="")
	{
	   alert('Please Enter GLRS Capacity of Private Field');
	   document.getElementById('glrs_capacity_private'+m).select();
	   return false;
	}
	}
	
	for(var n=1;n<=countglsr;n++)
	{
	if(document.getElementById('glsr_numbers_phed'+n).value=="")
	{
	   alert('Please Enter GLSR Numbers of PHED Field');
	   document.getElementById('glsr_numbers_phed'+n).select();
	   return false;
	}
	if(document.getElementById('glsr_numbers_gp'+n).value=="")
	{
	   alert('Please Enter GLSR Numbers of Gram Panchayat Field');
	   document.getElementById('glsr_numbers_gp'+n).select();
	   return false;
	}	
	if(document.getElementById('glsr_numbers_private'+n).value=="")
	{
	   alert('Please Enter GLSR Numbers of Private Field');
	   document.getElementById('glsr_numbers_private'+n).select();
	   return false;
	}	
	if(document.getElementById('glsr_capacity_phed'+n).value=="")
	{
	   alert('Please Enter GLSR Capacity of PHED Field');
	   document.getElementById('glsr_capacity_phed'+n).select();
	   return false;
	}	
	if(document.getElementById('glsr_capacity_gp'+n).value=="")
	{
	   alert('Please Enter GLSR Capacity of Gram Panchayat Field');
	   document.getElementById('glsr_capacity_gp'+n).select();
	   return false;
	}
	if(document.getElementById('glsr_capacity_private'+n).value=="")
	{
	   alert('Please Enter GLSR Capacity of Private Field');
	   document.getElementById('glsr_capacity_private'+n).select();
	   return false;
	}
	}
	return true;	
}


function validate7()
{
    if(document.getElementById('total_sub_pump').value=="")
	{
	   alert('Please Enter Submersible Pump in Total Field');
	   document.getElementById('total_sub_pump').focus();
	   return false;
	}
	a1=document.getElementById('operational_sub_pump').value;
    a1=Number(a1);
    a2=document.getElementById('standby_sub_pump').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('total_sub_pump').value!=a3)
    {
      alert('Please Check! Total Number of Submersible Pump and Operational & Stand by should be Equal');
      document.getElementById('total_sub_pump').select();
    return false;
    }
	if(document.getElementById('total_mono_block_pump').value=="")
	{
	   alert('Please Enter Mono- Block Pump in Total Field');
	   document.getElementById('total_mono_block_pump').focus();
	   return false;
	}
	a1=document.getElementById('operational_mono_block_pump').value;
    a1=Number(a1);
    a2=document.getElementById('standby_mono_block_pump').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('total_mono_block_pump').value!=a3)
    {
      alert('Please Check! Total Number of Mono- Block Pump and Operational & Stand by should be Equal');
      document.getElementById('total_mono_block_pump').select();
    return false;
    }
	if(document.getElementById('total_centrifugal_pump').value=="")
	{
	   alert('Please Enter Centrifugal Pump in Total Field');
	   document.getElementById('total_centrifugal_pump').focus();
	   return false;
	}
	a1=document.getElementById('operational_centrifugal_pump').value;
    a1=Number(a1);
    a2=document.getElementById('standby_centrifugal_pump').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('total_centrifugal_pump').value!=a3)
    {
      alert('Please Check! Total Number of Centrifugal Pump and Operational & Stand by should be Equal');
      document.getElementById('total_centrifugal_pump').select();
    return false;
    }
	if(document.getElementById('total_single_phase_pump').value=="")
	{
	   alert('Please Enter Single Phase Pump in Total Field');
	   document.getElementById('total_single_phase_pump').focus();
	   return false;
	}
	a1=document.getElementById('operational_single_phase_pump').value;
    a1=Number(a1);
    a2=document.getElementById('standby_single_phase_pump').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('total_single_phase_pump').value!=a3)
    {
      alert('Please Check! Total Number of Single Phase Pump and Operational & Stand by should be Equal');
      document.getElementById('total_single_phase_pump').select();
    return false;
    }
	if(document.getElementById('capacity_cwr').value=="")
	{
	   alert('Please Enter CWR in Capacity Field');
	   document.getElementById('capacity_cwr').focus();
	   return false;
	}
	
	if(document.getElementById('num_cwr').value=="")
	{
	   alert('Please Enter CWR in Total No. Field');
	   document.getElementById('num_cwr').focus();
	   return false;
	}
	a1=document.getElementById('functional_cwr').value;
    a1=Number(a1);
    a2=document.getElementById('non_functional_cwr').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('num_cwr').value!=a3)
    {
      alert('Please Check! Total Number of CWR and Functional & Non-Functional should be Equal');
      document.getElementById('num_cwr').select();
    return false;
    }
	if(document.getElementById('capacity_glsr').value=="")
	{
	   alert('Please Enter GLSR in Capacity Field');
	   document.getElementById('capacity_glsr').focus();
	   return false;
	}
	if(document.getElementById('num_glsr').value=="")
	{
	   alert('Please Enter GLSR in Total No. Field');
	   document.getElementById('num_glsr').focus();
	   return false;
	}
	a1=document.getElementById('functional_glsr').value;
    a1=Number(a1);
    a2=document.getElementById('non_functional_glsr').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('num_glsr').value!=a3)
    {
      alert('Please Check! Total Number of GLSR and Functional & Non-Functional should be Equal');
      document.getElementById('num_glsr').select();
    return false;
    }
	if(document.getElementById('capacity_glr').value=="")
	{
	   alert('Please Enter GLR in Capacity Field');
	   document.getElementById('capacity_glr').focus();
	   return false;
	}
	if(document.getElementById('num_glr').value=="")
	{
	   alert('Please Enter GLR in Total No. Field');
	   document.getElementById('num_glr').focus();
	   return false;
	}
	a1=document.getElementById('functional_glr').value;
    a1=Number(a1);
    a2=document.getElementById('non_functional_glr').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('num_glr').value!=a3)
    {
      alert('Please Check! Total Number of GLR and Functional & Non-Functional should be Equal');
      document.getElementById('num_glr').select();
    return false;
    }
	if(document.getElementById('capacity_ohsr').value=="")
	{
	   alert('Please Enter OHSR Capacity Field');
	   document.getElementById('capacity_ohsr').focus();
	   return false;
	}
	if(document.getElementById('num_ohsr').value=="")
	{
	   alert('Please Enter OHSR in Total No. Field');
	   document.getElementById('num_ohsr').focus();
	   return false;
	}
	a1=document.getElementById('functional_ohsr').value;
    a1=Number(a1);
    a2=document.getElementById('non_functional_ohsr').value;
    a2=Number(a2);
    a3=(a1+a2);
    if(document.getElementById('num_ohsr').value!=a3)
    {
      alert('Please Check! Total Number of OHSR and Functional & Non-Functional should be Equal');
      document.getElementById('num_ohsr').select();
    return false;
    }
		
	return true;
}



function validate4()
{
	var countloc=document.getElementById('loccount').value;
	//alert(countloc);
	for(var p=1;p<=countloc;p++)
	{
	if(document.getElementById('location'+p).value=="")
	{
	   alert('Please Enter Location Field');
	   document.getElementById('location'+p).focus();
	   return false;
	}
	
	/*var rad1=document.getElementById('function_status'+p);
	var rad2=document.getElementById('repairable_status'+p);
	//alert(rad2);
	var rad3=document.getElementById('remarks'+p);
	
	if(!rad1.checked && !rad2.checked)
	{
	  alert('please chec');
	  rad2.focus();
	  return false;
	}
	
	if(!rad1.checked && rad3.value=="")
	{
	  alert('please check');
	  rad3.focus();
	  return false;
	}*/
	var rad=document.getElementById('function_status'+p);
	 var rad1=document.getElementById('remarks'+p);
	 //alert(rad.value);
	 var chks = document.getElementsByName('repairable_status'+p);
     var hasChecked = false;
     if(!rad.checked)
	 {
	 for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Repairable Status');
    return false;
    }
	}
	if(!rad.checked && rad1.value=="")
	{
	   alert('Please Enter the Fields Remarks'+p);
	   rad1.focus();
	   return false;
	}
	
	
	
	//var rad=document.getElementById('function_status'+p);
	 
	 //alert(rad.value);
	 var chks = document.getElementsByName('opration_status'+p);
     var hasChecked = false;
     //if(!chk.checked)
	 //{
	 for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Operational Status');
    return false;
    }
	//}
	
	var chks = document.getElementsByName('quality_status'+p);
    var hasChecked = false;
	for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Quality Status');
    return false;
    }
	
	var chks = document.getElementsByName('yield'+p);
    var hasChecked = false;
	for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Yield');
    return false;
    }
	
	var chks = document.getElementsByName('seasonal_flunctuation'+p);
    var hasChecked = false;
	for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Seasonal Fluctuation');
    return false;
    }
	
	
	
	if(document.getElementById('water_table_fluctuation_min'+p).value=="")
	{
	   alert('Please Enter Water Table Flunctuation in min Field');
	   document.getElementById('water_table_fluctuation_min'+p).focus();
	   return false;
	}
	if(document.getElementById('water_table_fluctuation_max'+p).value=="")
	{
	   alert('Please Enter Water Table Flunctuation in Max Field');
	   document.getElementById('water_table_fluctuation_max'+p).focus();
	   return false;
	}
	if(document.getElementById('avg_depth'+p).value=="")
	{
	   alert('Please Enter Average Depth Field');
	   document.getElementById('avg_depth'+p).focus();
	   return false;
	}
	
	
	
}
    /*for(var p=1;p<=11;p++)
	{
	var chks = document.getElementsByName('drinking_water_safe'+p);
    var hasChecked = false;
	for (var i = 0; i < chks.length; i++)
     {
     if (chks[i].checked)
     {
     hasChecked = true;
     break;
     }
     }
	 if (hasChecked == false)
    {
    alert('Please Check at Least One in Drinking Water Safe');
    return false;
    }
    }*/
}
